package zifuIo;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Input_Output {
    //因为doc和图片都是二进制文件，所以不能用字符流

    //  将D:/course/02-JavaSE进阶/day01-常用类-1/笔记/第09章-java常用类.doc
    //  使用字符输入流读取，输出到day09-code/src/file/1.doc
    public static void main(String[] args) {
        System.out.println("开始复制");
        long start = System.currentTimeMillis();
        try (FileInputStream fis = new FileInputStream("D:/course/02-JavaSE进阶/day01-常用类-1/笔记/第09章-java常用类.doc");
             FileOutputStream fos = new FileOutputStream("day09-code/src/file/1.doc", true)) {

            byte[] car = new byte[1024];

            int len;

            while ((len = fis.read(car)) != -1){
                fos.write(car,0,len);
            }

            System.out.println("复制完毕");
            long end = System.currentTimeMillis();
            System.out.println("耗时：" + (end - start) + "毫秒");
        }
        catch (IOException e) {
            e.printStackTrace();
        }
    }
}
